package com.mm.organizational.controller;

import com.mm.organizational.service.OrgService;
import com.mm.utils.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * Created by Administrator on 2018/9/18/018.
 */
@RestController
@RequestMapping("/Org")
public class OrgController {
    @Autowired
    OrgService service;
    @GetMapping("/getList")
    public ResponseBean getList(@RequestParam Map map){
        List list=service.getList(map);
        return  new ResponseBean(200, "succcess", list);
    }
    @PostMapping("/Save")
    public ResponseBean Save(@RequestBody Map map){
        try{

            service.save(map);
            return  new ResponseBean(200, "succcess", true);
        }catch (Exception e){
            return  new ResponseBean(200, e.toString(), false);
        }
    }
    @GetMapping("/Delete")
    public ResponseBean delete(@RequestParam Map map){
        try{
            service.delete(map);
            return  new ResponseBean(200, "succcess", true);
        }catch (Exception e){
            return  new ResponseBean(200, e.toString(), false);
        }
    }
}
